<%@page import="dao.ArticalDaoImpl"%>
<%@page import="dao.ArticalDao"%>
<%@page import="java.util.List"%>
<%@page import="dao.PostDaoImpl"%>
<%@page import="dao.PostDao"%>
<%@page import="entity.*" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<font size = 8 >我的帖子</font>
<input type = "button" value = "返回" onclick = "window.top.location.href = 'index.jsp'">
<hr width = 1000>
<%
User user = (User)session.getAttribute("User");
PostDao postDao = new PostDaoImpl();
List<Post> posts = postDao.findPostByAuthor(user.getUserName());
for(int i = 0;i < posts.size();i++){
%>
<a href = "apost.jsp?id=<%=posts.get(i).getId() %>"><font><%=posts.get(i).getTitle() %></font size = 4></a>
<img onclick="window.top.location.href = 'DeletPostServlet?id=<%=posts.get(i).getId()%>'" src=img/del.jpg width=10 height=10><br>
<%} 
%>
<hr width = 1000>
<font size = 8 >我的回复</font><br>
<%

ArticalDao articalDao = new ArticalDaoImpl();
List<Artical> articals = articalDao.findArticalByAuthor(user.getUserName());
for(int i = 0;i < articals.size();i++){
%>
<a href = "apost.jsp?id=<%=articals.get(i).getLordId() %>&location=<%=articals.get(i).getFloor()%>"><font><%=articals.get(i).getText() %></font size = 4></a>
<img onclick="window.top.location.href = 'DeleteArtServlet?id=<%=articals.get(i).getLordId()%>&floor=<%=articals.get(i).getFloor()%>'" src=img/del.jpg width=10 height=10><br>
<%} %>
</center>
</body>
</html>